import { ${ClassName}FormData, ${ClassName}Item, ${ClassName}PageResult, ${ClassName}QueryParam } from '@/types'
import request from '@/utils/request'
import { AxiosPromise } from 'axios'

/**
* 获取分页列表
*
* @param queryParams
*/
export function list${ClassName}Pages(queryParams: ${ClassName}QueryParam):AxiosPromise<${ClassName}PageResult> {
    return request({
        url: '<#if moduleName??>/mall-${moduleName}</#if>/api/v1/${classname}/page',
        method: 'get',
        params: queryParams
    })
}

    /**
    * 获取列表
    *
    * @param queryParams
    */
export function list${ClassName}(queryParams?: ${ClassName}QueryParam):AxiosPromise<${ClassName}Item[]> {
    return request({
        url: '<#if moduleName??>/mall-${moduleName}</#if>/api/v1/${classname}',
        method: 'get',
        params: queryParams
    })
}

    /**
    * 获取详情
    *
    * @param id
    */
export function get${ClassName}FormDetail(id: number):AxiosPromise<${ClassName}FormData> {
    return request({
        url: '<#if moduleName??>/mall-${moduleName}</#if>/api/v1/${classname}/' + id,
        method: 'get'
    })
}

/**
* 添加
*
* @param data
*/
export function add${ClassName}(data: ${ClassName}FormData) {
    return request({
        url: '<#if moduleName??>/mall-${moduleName}</#if>/api/v1/${classname}',
        method: 'post',
        data: data
    })
}

/**
* 修改
*
* @param id
* @param data
*/
export function update${ClassName}(id:number, data:${ClassName}FormData) {
    return request({
        url: '<#if moduleName??>/mall-${moduleName}</#if>/api/v1/${classname}/' + id,
        method: 'put',
        data: data
    })
}

/**
* 删除
*
* @param ids
*/
export function delete${ClassName}(ids: string) {
    return request({
        url: '<#if moduleName??>/mall-${moduleName}</#if>/api/v1/${classname}/' + ids,
        method: 'delete'
    })
}